home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_100 / 163_01 / fseek2.c < prev    next >
Text File  |  1988-01-30  |  640b  |  18 lines

  1. /*
  2. ** reposition a stream file
  3. */
  4. #define FILE int
  5. #include <streamio.h>
  6. extern int fflush(), _seek(), free();
  7.  
  8. fseek2(stream, offset, ptrname) FILE *stream; int offset, ptrname; {
  9.   fflush(stream);  /* flush any write data */
  10.   if(stream[_IOB_CNT]) {  /* free read buffer if present */
  11.     free(stream[_IOB_BASE]);
  12.     stream[_IOB_CNT] = 0;
  13.     }
  14.   stream[_IOB_FLAG] &= ~(_UNGET);
  15.   _seek(stream[_IOB_FD], offset, ptrname);
  16.   return 0;
  17.   }
  18.